package junit.com.cpi.cornpp.period.dao;

import java.util.List;

import junit.framework.TestCase;

import com.cpi.cornpp.period.dao.PeriodDAO;
import com.cpi.cornpp.period.exception.PeriodException;

public class PeriodDAOTest extends TestCase {
	private PeriodDAO periodDAO;
	private int active_status;
	//private List periodList;
	private List periodList;
	private int periodsInDB;
	public PeriodDAOTest(String name) {
		super(name);
	}

	protected void setUp() throws Exception {
		periodDAO = new PeriodDAO();
		active_status = 1;
		periodsInDB = 0;
	}

	protected void tearDown() throws Exception {
		periodDAO =  null;
	}

	public void testGetPeriodsByStatus() {
		try {
			periodList = periodDAO.getPeriodsByStatus(active_status);
			assertEquals(periodList.size(),periodsInDB);
		} catch (PeriodException periodException) {
			fail("Error : <" + periodException.getExceptionCode()+"> ["+periodException.getMessage()+"]");
		}
	}
}
